<?php

include ("include/config.php");


stemplate::assign("main_categories", core_categories());


require($config['basedir']."/classes/category.class.php");
$post = $_REQUEST;
$obj_cat = new Category();

$_action = isset($_REQUEST['action']) ? $_REQUEST['action'] : 'view';

switch($_action) {

	case 'detail':
		stemplate::assign("post", $post);
		$product_detail = $obj_cat->getProductDetailById($post);
		//varDump($product_detail);
		stemplate::assign('product', $product_detail);
		stemplate::assign("_page_title", "Products ::".$product_detail['name']);
		stemplate::display("product_detail.tpl");
   	break;
	
	case 'addToCart':
		$obj_cat->addToCart($post); 
	break;
	
	case 'view':
	default:
  		stemplate::assign("_page_title", "Products");
		stemplate::assign("main_categories", core_categories());
		stemplate::display("product.tpl");
    break; 

}




?>